package bishi;

/**
 * @Author liuhaoqi
 * @Date 2020/8/28 19:30
 * @Version 1.0
 */
public class HikVison01 {
    public static void main(String[] args) {

    }

    public static int reverse(int num) {
        int ans =0;
        int remainder=0;
        int bit =1;
            while (num != 0) {
                remainder = num % 10;
                ans= ans*10+remainder;
                num = num / 10;
                if (ans > Integer.MAX_VALUE / 10) {
                   return 0;
                } else if (ans == Integer.MAX_VALUE / 10 && remainder > 7) {
                    return 0;
                } else if (ans < Integer.MIN_VALUE / 10) {
                    return 0;
                } else if (ans == Integer.MIN_VALUE / 10 && remainder < -8) {
                    return 0;
                }
            }
        return ans;
    }
}
